import { constantRoutes, asyncRoutes } from '@/router/index'

const state = {
  routes: []
}

const mutations = {
  setRoutes(state, routes) {
    state.routes = [...constantRoutes, ...routes]
  }
}
const actions = {
  filterRoutes(store, menus) {
    const result = asyncRoutes.filter(v => menus.indexOf(v.name) !== -1)
    return result
  }
}
export default {
  namespaced: true,
  state,
  mutations,
  actions
}
